<?php
class category{
	function selectCategory()
	{
		global $con;
		$sql="select * from tbl_category";
		$res = mysqli_query($con,$sql);
		return $res;
	}/// EOF
	
	function addCategory($cat_name,$cat_details,$cat_add_date,$cat_image)
	{
		global $con;
		$sql="INSERT INTO tbl_category SET 
			cat_name='$cat_name', 
			cat_details='$cat_details', 
			cat_added_date='$cat_add_date', 
			cat_image='$cat_image'";
		mysqli_query($con,$sql);
	}/// EOF
	function deleteCategory($id)
	{
		global $con;
		$sql="DELETE FROM tbl_category WHERE cat_id='$id' ";
		mysqli_query($con,$sql);
		}
	function editCategory($catId,$catName,$catDetails,$date,$cat_image)
	{
		global $con;
		$sql="UPDATE tbl_category SET cat_name='$catName',cat_details='$catDetails', cat_added_date='$date', cat_image='$cat_image' WHERE cat_id='$catId'";
		mysqli_query($con,$sql);
	}	
	function getCategoryById($id)
	{
		global $con;
		$sql="SELECT *FROM tbl_category WHERE cat_id='$id'";
		$res=mysqli_query($con,$sql);
		return $res;	
	}
	
}//EOC


$objCategory=new category();
?>
